package DailyPractice.Day2;

import java.util.Scanner;

/**
 * @author lumin
 * @date 2022/04/18 19:28
 **/
public class Num2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        StringBuilder sb = new StringBuilder(str);
        sb.reverse();
        String str1 = sb.toString();
        char[] arr = str1.toCharArray();
        int i = 0;
        int index = 0;
        while(i < arr.length){
            if(arr[i] == ' '){
                swap(arr,index,i - 1);
                index = i + 1;
            }
            i++;
        }
        swap(arr,index,arr.length - 1);
        String str2 = new String(arr);
        System.out.println(str2);
    }

    private static void swap(char[] arr, int index, int i) {
        while(index <= i){
            char temp = arr[index];
            arr[index] = arr[i];
            arr[i] = temp;
            index++;
            i--;
        }
    }
}